class Child extends React.Component {
  constructor(props){
    super(props);
  }
  render() {
    return (
      <button onClick={this.props.trigger}>{this.props.name}</button>
    )
  }
}

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      value : 0 
    }
    this.triggerIncrement = this.triggerIncrement.bind(this);
    this.triggerDecrement = this.triggerDecrement.bind(this);
  }
  triggerIncrement(e){
    this.setState({
      value: this.state.value + 1
    })
  }
  triggerDecrement(){
    this.setState({
      value: this.state.value - 1
    })
  }
  render() {
    return (
      <div>
        <h1>App: {this.state.value} </h1>
        <Child value={this.state.value} name="increment" trigger={this.triggerIncrement} />
        <Child value={this.state.value} name="decrement" trigger={this.triggerDecrement} />
      </div>
    );
  }
}
ReactDOM.render(
  <App />,
  document.getElementById('root')
);